package io;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) throws IOException {
        OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("note.txt",true), StandardCharsets.UTF_8);
        Scanner s = new Scanner(System.in);
        String str = "";
        System.out.println("开始输入内容，单独输入exit退出");
        while(!"exit".equalsIgnoreCase(str=s.next())){
            osw.write(str+"\n");
        }
        osw.close();
        System.out.println("结束");
    }
}
